package com.moive.news.tqnewsapplication.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.moive.news.tqnewsapplication.R;
import com.moive.news.tqnewsapplication.adapter.FragmentVpAdapter;
import com.moive.news.tqnewsapplication.base.BaseActivity;
import com.moive.news.tqnewsapplication.ui.fragment.AttentFragment;
import com.moive.news.tqnewsapplication.ui.fragment.FansFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/12/11.
 */

public class FansActivity extends BaseActivity {
    @BindView(R.id.main_tab)
    TabLayout mainTab;
    @BindView(R.id.main_viewpager)
    ViewPager mainViewpager;
    private List<String> tablist = new ArrayList<>();
    private ArrayList<Fragment> fgs = new ArrayList<Fragment>();
    private FragmentVpAdapter fragmentVpAdapter;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fans);
        ButterKnife.bind(this);
        init();
    }
    private void init() {
        tablist.clear();
        tablist.add("关注");
        tablist.add("粉丝");
        fgs.add(new AttentFragment());
        fgs.add(new FansFragment());
        fragmentVpAdapter=new FragmentVpAdapter(getSupportFragmentManager(),tablist,fgs);
        mainViewpager.setAdapter(fragmentVpAdapter);
        mainTab.setupWithViewPager(mainViewpager, true);
        mainViewpager.setOffscreenPageLimit(2);

    }


}
